/**
 * @file BaseNodeVar.h
 * @author 世慷 (shikang999@126.com)
 * @brief 
 * @version 0.1
 * @date 2025-10-01
 * 
 * @copyright Copyright (c) 2025
 * 
 */

#pragma once
#include <vector>
#include <memory>
#include <string>
#include <eigen3/Eigen/Dense>
namespace Net
{

//1.
using Value_t = double;
using Vector_t = Eigen::VectorX<Value_t>;
using Matrix_t = Eigen::Matrix<Value_t, Eigen::Dynamic, Eigen::Dynamic>;

//2.节点变量类型
enum class NodeVarType_E : uint8_t
{
    Value_E  = 0, //单个数值
    Vector_E = 1, //向量
    Matrix_E = 2, //二维矩阵
    Array_E  = 3, //数组
};

//3.网络层节点基类
class BaseNodeVar
{
public:
    BaseNodeVar(NodeVarType_E type);
    virtual ~BaseNodeVar();

    //设置ID
    void setID(uint32_t id);

    //获取ID
    uint32_t getID() const;

    //设置名称
    void setName(const std::string &name);

    //获取名称
    const std::string &getName() const;

    //设置变量固定状态
    void setFixed(bool isFixed);

    //获取变量固定状态
    bool isFixed() const;

    //获取类型
    NodeVarType_E getType() const;

    //获取当前节点维度
    virtual std::vector<std::size_t> getDim() const = 0;

    //获取真实变量个数
    virtual uint32_t getVarSize() const = 0;
    
private:
    uint32_t id_;
    bool fixed_;         //是否固定
    NodeVarType_E type_;
    std::string name_;
};

using vecBaseNodeVar_t = std::vector<std::shared_ptr<BaseNodeVar>>;

}